#include <iostream>

using namespace std;

int n, k;   //n*n, k个
int ans = 0;
int chk[10][2] = {0}; //0行, 1列

void dfs(int x, int cnt){ //x代表第x行, cnt为总共放了几个棋子
    if(cnt == k){
        ans++;
        return;
    }
    if(x > n)   return;
    for(int i = 1; i <= n; i++){
        if(chk[i][0] == 0 && chk[i][1] == 0){
            chk[i][0] = chk[i][1] = 1;
            dfs(x + 1, cnt + 1);
            chk[i][0] = chk[i][1] = 0;
        }
    }
    dfs(x + 1, cnt);
}

int main(){
    cin >> n >> k;
    dfs(1, 0);
    cout << ans;
    return 0;
}